﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using CommClass;
using DMS.CommClass;


namespace DMS
{
    public partial class Frmviewyueku : DMS.FrmTemplate 
    {
        Report Rpt = new Report();
        CaigouDAO cg = new CaigouDAO(App.Ds);
        string mergenumber;
        int CaigouID11 = 0;  
        string sqlstr;
        bool flag;

        public Frmviewyueku(string CaigouID)
        {
            InitializeComponent();
            DataTable dt = cg.GetCaigou("a.CaigouID = " + CaigouID);
            CaigouID11 = int.Parse(CaigouID);
           if (dt.Rows.Count > 0)
           {

               label14.Text = dt.Rows[0]["CaigouNumber"].ToString();
               label15.Text = dt.Rows[0]["StoreName"].ToString();
               label16.Text = dt.Rows[0]["CarrierName"].ToString();
               label17.Text = dt.Rows[0]["TuiHuoKeHu"].ToString();
               label18.Text = dt.Rows[0]["TuiHuoRemark"].ToString();
               label19.Text = dt.Rows[0]["CaigouTypemiaoshu"].ToString();
               label20.Text = dt.Rows[0]["SupplierName"].ToString();
               label21.Text = dt.Rows[0]["SupplySupplierName"].ToString();
               label22.Text = dt.Rows[0]["CaigouDate"].ToString();
               label23.Text = dt.Rows[0]["zhidanren"].ToString();
               label24.Text = dt.Rows[0]["Remark"].ToString();
               label25.Text = dt.Rows[0]["caigouren"].ToString();
               label1.Text = dt.Rows[0]["CaigouStatusmiaoshu"].ToString();
           }

           this.dgvdo.DataSource = cg.GetCaigouEntry("a.CaigouID = " + CaigouID);
           if (this.dgvdo.ColumnCount > 0)
           {
               for (int i = 0; i < this.dgvdo.ColumnCount; i++)
               {
                   this.dgvdo.Columns[i].ReadOnly = true;
               }
               this.dgvdo.Columns[9].Visible = false;
               this.dgvdo.Columns[10].Visible = false;
               this.dgvdo.Columns[11].Visible = false;
           }
    
        }


       



        private void button3_Click(object sender, EventArgs e)
        {


            Rpt.SourceData = cg.GetCaigouprint(" a.CaigouID = " + CaigouID11).DefaultView;
            Rpt.ReportName = @"Report\RptCaiGou.rdlc";  
            Rpt.Parameters.Clear();
           // for (int i = 0; i < int.Parse(listBox1.SelectedValue.ToString()); i++)
          //  {
                Rpt.Print();
          //  }
            //Report Rpt1 = new Report();
            //Rpt1.SourceData = mo.GetVehilceEntry(mergenumber).DefaultView;
            //Rpt1.ReportName = @"Report\RptVehicleEntry.rdlc";

            //Rpt1.Print();
            button3.Enabled = false;
        }


        
    }
}
